project (MtkTet)
set (MtkTet_VERSION_MAJOR 0)
set (MtkTet_VERSION_MINOR 1)
set (MtkTet_VERSION_PATCH 0)

cmake_minimum_required (VERSION 2.6)

message (STATUS "Project source dir = ${PROJECT_SOURCE_DIR}")
message (STATUS "Project build dir = ${CMAKE_BINARY_DIR}")

# we don't want any build files in src directory
if (${PROJECT_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
    message (FATAL_ERROR "Not allowed to run in-source build!")
endif ()


set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules"
                       "${PROJECT_SOURCE_DIR}/cmake")


# default we build debug version of the project
if (NOT CMAKE_BUILD_TYPE)
    set (CMAKE_BUILD_TYPE "Debug")
endif ()

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
    add_definitions (-DDEBUG=1)
endif ()


find_package (Allegro REQUIRED)
# FIXME: should be more gentle. Get rid of this ASAP
set (LALLEG "-lalleg-4.2.2")

# project files
if (ALLEGRO_FOUND)
    include_directories (${ALLEGRO_INCLUDE_DIRS})
    set (MtkTet_srcs main.cpp game.cpp)
    add_executable (MtkTet ${MtkTet_srcs})
    target_link_libraries (MtkTet ${ALLEGRO_LIBRARIES} ${LALLEG})
    #add_definitions (${CMAKE_THREAD_LIBS_INIT})
endif ()